package com.dianxin.smartpark.web.attendance;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.access.SmartParkAccessControlPassRecordQO;
import com.dianxin.smartpark.dao.qo.attendance.SmartParkAttendanceRecordQO;
import com.dianxin.smartpark.service.attendance.SmartParkAttendanceRecordService;
import com.dianxin.smartpark.service.vo.attendance.SmartParkAttendanceRecordVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 考勤记录
 * @program: smart-park
 * @description: 考勤记录
 * @author: chenyong
 * @create: 2021-08-04 17:40
 */
@RestController
@RequestMapping("/smartpark/attendance/attendanceRecord")
public class SmartParkAttendanceRecordController {

    @Resource
    private SmartParkAttendanceRecordService smartParkAttendanceRecordService;

    /**
     * 打卡记录分页
     * @Description:  打卡记录分页
     * @Author: ChenYong
     * @Date: 2021/8/4 0004
     * @param smartParkAttendanceRecordQO:
     * @Return: CommonResponseBody<List<SmartParkAttendanceRecordVO>>
     */
    @PostMapping("/getAttendanceRecords")
    @RecordLog(name = "考勤记录查询")
    @SaCheckPermission("/attendance/attendanceRecord/getAttendanceRecords")
    public CommonResponseBody<List<SmartParkAttendanceRecordVO>> getAttendanceRecords(@RequestBody SmartParkAttendanceRecordQO smartParkAttendanceRecordQO) {
        return smartParkAttendanceRecordService.getAttendanceRecords(smartParkAttendanceRecordQO);
    }

    /**
     * 添加打卡记录
     * @Description:  添加打卡记录
     * @Author: ChenYong
     * @Date: 2021/8/4 0004
     * @param smartParkAttendanceRecordQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveAttendanceRecord")
    @RecordLog(name = "考勤记录查添加")
    @SaCheckPermission("/attendance/attendanceRecord/saveAttendanceRecord")
    public CommonResponseBody saveAttendanceRecord(@RequestBody SmartParkAttendanceRecordQO smartParkAttendanceRecordQO) {
        return smartParkAttendanceRecordService.saveAttendanceRecord(smartParkAttendanceRecordQO);
    }

    /**
     * 添加考勤缺卡记录
     * @Description:  添加考勤缺卡记录
     * @Author: ChenYong
     * @Date: 2021/8/19 0019
     * @param smartParkAttendanceRecordQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveAbnormalAttendanceRecord")
    @RecordLog(name = "异常考勤记录添加")
    @SaCheckPermission("/attendance/attendanceRecord/saveAbnormalAttendanceRecord")
    public CommonResponseBody saveAbnormalAttendanceRecord(@RequestBody SmartParkAttendanceRecordQO smartParkAttendanceRecordQO){
        return smartParkAttendanceRecordService.saveAbnormalAttendanceRecord(smartParkAttendanceRecordQO);
    }

    /**
     * 手动添加考勤缺卡记录
     * @Description:  手动添加考勤缺卡记录
     * @Author: ChenYong
     * @Date: 2021/8/19 0019
     * @param smartParkAttendanceRecordQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/manualSaveAbnormalRecord")
    @RecordLog(name = "异常考勤记录添加")
    @SaCheckPermission("/attendance/attendanceRecord/manualSaveAbnormalRecord")
    public CommonResponseBody manualSaveAbnormalRecord(@RequestBody SmartParkAttendanceRecordQO smartParkAttendanceRecordQO){
        return smartParkAttendanceRecordService.manualSaveAbnormalRecord(smartParkAttendanceRecordQO);
    }
    /**
     * 手动保存打卡记录
     * @Description:  手动保存打卡记录
     * @Author: ChenYong
     * @Date: 2021/8/31 0031
     * @param smartParkAccessControlPassRecordQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/manualSaveRecord")
    @RecordLog(name = "手动生成考勤记录")
    @SaCheckPermission("/attendance/attendanceRecord/manualSaveRecord")
    public CommonResponseBody manualSaveRecord(@RequestBody SmartParkAccessControlPassRecordQO smartParkAccessControlPassRecordQO){
        return smartParkAttendanceRecordService.manualSaveRecord(smartParkAccessControlPassRecordQO);
    }

    /**
     * 保存APP打卡
     * @Description:  保存APP打卡
     * @Author: ChenYong
     * @Date: 2021/9/3 0003
     * @param smartParkAttendanceRecordQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveAppAttendanceRecord")
    @RecordLog(name = "保存APP打卡")
    @SaCheckPermission("/attendance/attendanceRecord/saveAppAttendanceRecord")
    public CommonResponseBody saveAppAttendanceRecord(@RequestBody SmartParkAttendanceRecordQO smartParkAttendanceRecordQO) {
        return smartParkAttendanceRecordService.saveAppAttendanceRecord(smartParkAttendanceRecordQO);
    }

}
